//
//  StaticConfig.swift
//  Scaner
//
//  Created by liyahao on 2025/4/15.
//

import UIKit

class AppUtils: NSObject {

}

extension PathTool {
    static var scaner: String? {
        if let scaner = self.docuPath?.appendingPath("scaner") {
            self.makeFolder(scaner)
            return scaner
        }
        return nil
    }
    
    static var audios: String? {
        if let audios = self.docuPath?.appendingPath("audios") {
            self.makeFolder(audios)
            return audios
        }
        return nil
    }
    
    /// 生成新建录音文件
    static var newAudioPath: URL? {
        if let audio = PathTool.audios {
            let name = UUID().uuidString + ".m4a"
            return URL(filePath: audio.appendingPath(name))
        }
        return nil
    }
    
    static func delAudios(_ name: String) {
        if let audios = self.audios?.appendingPath(name) {
            self.deleteFile(audios)
        }
    }
    
    static func delScaner(_ name: String) {
        if let audios = self.scaner?.appendingPath(name) {
            self.deleteFile(audios)
        }
    }
}
